home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / dev / c / vbccwos.lha / vbcc / doc / pasm.doc < prev    next >
Text File  |  1999-03-07  |  45KB  |  2,191 lines

  1. pasm V1.2          VBCC ANSI C Compiler Reference Manual            pasm V1.2
  2.  
  3. NAME
  4.      pasm - PowerPC assembler
  5.  
  6. SYNOPSIS
  7.      pasm [-mwxRVX] [-B address] [-D symbol[=value]] [-F format]
  8.           [-I include-path] [-O opt-level] [-o filename] source-file
  9.  
  10. DESCRIPTION
  11.      pasm is a 32/64-bit PowerPC assembler and its usual task is to
  12.      assemble the output of the vbcc C compiler. It supports macros
  13.      and include files, so it could also be used for direct PowerPC
  14.      program development.
  15.  
  16.      pasm uses the same syntax as Motorola's PAS assembler or the
  17.      PPC-port of the GNU assembler.
  18.  
  19.      All PowerPC standard instructions are supported: User level-,
  20.      supervisor level-, optional-, 32-bit and 64-bit instructions.
  21.      Additionally, there is a huge set of extended mnemonics as proposed
  22.      in the "PowerPC Programming Environments" from IBM and Motorola.
  23.  
  24.      The options are as follows:
  25.  
  26.      -B address
  27.              Sets the base address for absolute output format.
  28.  
  29.      -D symbol[=value]
  30.              Defines a symbol. Its value defaults to '1'.
  31.  
  32.      -F format
  33.              Sets the output file format:
  34.              0: Absolute, raw format. Base address defaults to
  35.                 zero, but may be changed by "-B addr".
  36.              1: ELF-32bit-PowerPC object.
  37.              2: EHF object. Only used under AmigaOS with WarpOS
  38.                 extension from Haage&Partner.
  39.              3: ADOS object. The difference between ADOS and and EHF
  40.                 is, that ADOS uses HUNK_CODE instead HUNK_PPC_CODE
  41.                 and doesn't support any PPC-specific relocations and
  42.                 reference types. This makes it possible to link
  43.                 simple PowerPC programs with an old linker, like
  44.                 BLink, SLink or PhxLnk.
  45.  
  46.      -I include-path
  47.              Adds another include file path. Example:
  48.              -IWork:PPCIncludes  or  -I /usr/local/include
  49.  
  50.      -m64    Enable 64-bit instructions.
  51.  
  52.      -ms     Enable supervisor instructions.
  53.  
  54.      -mo     Enable optional instructions.
  55.  
  56.      -O opt-level
  57.              Sets optimization level. The level contains 32 flags to
  58.              enable different optimizations and features. Currently,
  59.              the following are used:
  60.              0x00010000: Automatic correction of far branches. A
  61.                          "Bcc label" with label out of range (more
  62.                          than 32764 bytes away) will be converted
  63.                          into a "B!cc $+8 / B label" combination.
  64.  
  65.      -o filename
  66.              Specifies the name of the output file. If not given, pasm
  67.              will use the name of the source text and replaces the
  68.              extension by ".o".
  69.  
  70.      -R      Don't predefine register symbols r0-r31, f0-f31, cr0-c7,
  71.              xer, eq, etc.
  72.  
  73.      -V      Prints version identification and build string. Example:
  74.              pasm V0.69 (Amiga OS/M68k)  (c)1997-98 by Frank Wille
  75.              build date: Jan  2 1998, 11:51:47
  76.  
  77.      -w      Suppress all warning messages.
  78.  
  79.      -x      Undefined symbols are automatically defined as external
  80.              symbols.
  81.  
  82.      -X      No extended mnemonics. This means you will have to write
  83.              "bc 12,2,label" instead "beq label". All predefined extened
  84.              mnemonics are listed in the section EXTENDED MNEMONICS.
  85.  
  86.  
  87. GENERAL FORMAT
  88.      Source texts in the following format will be accepted by pasm:
  89.  
  90.      [<label>] [<opcode> [<operand>[,<operand>,...]]]
  91.  
  92.      The opcode field may start at the first column, because pasm requires
  93.      all labels to be terminated by a ':'. Opcodes are directives, macros
  94.      and PowerPC instructions.
  95.  
  96.      These statements are separated by a line feed (0xa) or a ';' character.
  97.      Theoretically, you can write your whole program in a single line.
  98.      Example:
  99.  
  100.      .text;.global start;start: li r3,0;blr
  101.  
  102.      Comments are introduced by a '#':
  103.  
  104.      # This is a comment
  105.              nop     # another comment
  106.  
  107.  
  108. SNYTAX
  109.  
  110.      Supported operators in expressions:
  111.  
  112.           Unary (highest priority):
  113.           +             positive
  114.           -             negate
  115.           ~             not
  116.  
  117.           Binary (priority):
  118.           +             addition (4)
  119.           -             subtraction (4)
  120.           *             multiplication (5)
  121.           /             division (5)
  122.           %             modulo (5)
  123.           <<            shift left (3)
  124.           >>            shift right (3)
  125.           &             and (2)
  126.           |             or (0)
  127.           ^             exclusive or (1)
  128.  
  129.      Supported constants:
  130.  
  131.           1234          decimal
  132.           01234         octal
  133.           0x1234        hexadecimal
  134.           0b1010        binary
  135.           "abcd"        string
  136.  
  137.      ELF relocation suffix:
  138.  
  139.           Syntax: <expression>@<reloc type>
  140.  
  141.           @l            low half word (R_PPC_ADDR16_LO)
  142.           @h            high half word (R_PPC_ADDR16_HI)
  143.           @ha           high half word for addition (R_PPC_ADDR16_HA)
  144.           @sdax         base relative section offset (R_PPC_SDAREL16)
  145.           @sdarx        base relative section offset (R_PPC_SDAREL16)
  146.  
  147.  
  148.  
  149. DIRECTIVES
  150.       .ascii <exp1>[,<exp2>,"<string1>"...]
  151.       ----------------------------------
  152.       See ".byte".
  153.  
  154.       .asciiz "<string1>"[,"<string2>"...]
  155.       ------------------------------------
  156.       See ".string".
  157.  
  158.       .align <bit_count>
  159.       ------------------
  160.       Insert as much zero bytes as required to reach an address where
  161.       <bit_count> low order bits are zero. For example ".align 2" would
  162.       make an alignment to the next 32-bit boundary.
  163.  
  164.       .baserel <section>,<base_reg>
  165.       -----------------------------
  166.       Allow base relative access via register <base_reg> in the section
  167.       called <section>. In absolute mode, <base_reg> must be initialized
  168.       with an address pointing 32764 bytes behind the start address of
  169.       this section. In EHF, <base_reg> must be initialized with the linker
  170.       symbol _LinkerDB. By default, base relative access via r2 (rtoc)
  171.       on the section ".tocd" is set.
  172.       ** This directive is obsolete, since pasm V1.1! **
  173.       pasm can access multiple small data sections using the .sdreg
  174.       directive now. .baserel may be useful, when creating an
  175.       absolute output file, though.
  176.  
  177.       .bss <symbol>,<size>[,<alignment>]
  178.       ----------------------------------
  179.       Allocate <size> bytes of space in the .bss section and assign
  180.       the value to that location to <symbol>. If <alignment> is given,
  181.       then the space will be aligned to an address having <alignment>
  182.       low zero bits or 2, whichever is greater.
  183.       <symbol> may be made globally visible by the .globl directive.
  184.  
  185.       .byte <exp1>[,<exp2>,"<string1>"...]
  186.       ------------------------------------
  187.       Assign the integer or string constant operands into successive
  188.       bytes of memory in the current section. Any combination of integer
  189.       and character string constant operands is permitted.
  190.  
  191.       .comm <symbol>,<size>
  192.       ---------------------
  193.       Allocate <size> bytes of space in the .bss section and assign
  194.       the value to that location to <symbol>. <symbol> is always made
  195.       globally visible. ".comm"-areas of less than 8 bytes in size are
  196.       aligned to word boundaries, otherwise to doubleword boundaries.
  197.  
  198.       .double <float1>[,<float2>...]
  199.       ------------------------------
  200.       If the current section location counter is not on a doubleword
  201.       boundary advance it to the next doubleword boundary. Then assign
  202.       the values of the operands as IEEE 754 double-precision 64-bit
  203.       format numbers to successive doublewords of memory in the current
  204.       section.
  205.  
  206.       .else
  207.       -----
  208.       Begins the "else"-part in a block of conditional assembly.
  209.  
  210.       .endif
  211.       ------
  212.       Ends a block of conditional assembly.
  213.  
  214.       .endm
  215.       -----
  216.       Ends a macro definition.
  217.  
  218.       .extern <symbol>
  219.       ----------------
  220.       See ".globl".
  221.  
  222.       .fail
  223.       -----
  224.       Abort assembly with displaying the error message "fail directive
  225.       encountered".
  226.  
  227.       .file "<file name>"
  228.       -------------------
  229.       Specify the source file name, w